package com.wyg.blog.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @description:
 * @author: WYG
 * @time: 2020/12/28 22:09
 */
@Component
@ConfigurationProperties(prefix = "elasticsearch")
public class ElasticsearchProperties {
    /**
     *  esAddress.
     */
    private String esAddress;

    /**
     * 连接超时时间
     */
    private int connectTimeOut;
    /**
     * 连接超时时间
     */
    private int socketTimeOut;
    /**
     * 获取连接的超时时间
     */
    private int connectionRequestTimeOut;
    /**
     * 最大连接数
     */
    private int maxConnectNum;
    /**
     * 最大路由连接数
     */
    private int maxConnectPerRoute;

    /**
     * keepAlive保活策略
     */
    private int keepAliveMinutes;

    public ElasticsearchProperties() {}

    public ElasticsearchProperties(String esAddress, int connectTimeOut, int socketTimeOut,
                                   int connectionRequestTimeOut, int maxConnectNum, int maxConnectPerRoute,
                                   int keepAliveMinutes) {
        this.esAddress = esAddress;
        this.connectTimeOut = connectTimeOut;
        this.socketTimeOut = socketTimeOut;
        this.connectionRequestTimeOut = connectionRequestTimeOut;
        this.maxConnectNum = maxConnectNum;
        this.maxConnectPerRoute = maxConnectPerRoute;
        this.keepAliveMinutes = keepAliveMinutes;
    }

    public String getEsAddress() {
        return esAddress;
    }

    public void setEsAddress(String esAddress) {
        this.esAddress = esAddress;
    }

    public int getConnectTimeOut() {
        return connectTimeOut;
    }

    public void setConnectTimeOut(int connectTimeOut) {
        this.connectTimeOut = connectTimeOut;
    }

    public int getSocketTimeOut() {
        return socketTimeOut;
    }

    public void setSocketTimeOut(int socketTimeOut) {
        this.socketTimeOut = socketTimeOut;
    }

    public int getConnectionRequestTimeOut() {
        return connectionRequestTimeOut;
    }

    public void setConnectionRequestTimeOut(int connectionRequestTimeOut) {
        this.connectionRequestTimeOut = connectionRequestTimeOut;
    }

    public int getMaxConnectNum() {
        return maxConnectNum;
    }

    public void setMaxConnectNum(int maxConnectNum) {
        this.maxConnectNum = maxConnectNum;
    }

    public int getMaxConnectPerRoute() {
        return maxConnectPerRoute;
    }

    public void setMaxConnectPerRoute(int maxConnectPerRoute) {
        this.maxConnectPerRoute = maxConnectPerRoute;
    }

    public int getKeepAliveMinutes() {
        return keepAliveMinutes;
    }

    public void setKeepAliveMinutes(int keepAliveMinutes) {
        this.keepAliveMinutes = keepAliveMinutes;
    }
}
